#!/usr/bin/env python
# -*-coding:utf-8-*-
# File    : liyuqi.py
# Date    : 2021-02-01
# Author  : Tom.Lee


def urldecode(params):
    params_dict = {}
    for p in params.split('&'):
        kv = p.split('=')
        if len(kv) == 2:
            params_dict[kv[0]] = kv[1]
        elif len(kv) == 1:
            params_dict[kv[0]] = ""
        else:
            raise ValueError(kv)
    return params_dict


if __name__ == '__main__':
    params = 'pageSize=30&product=EFund&DISCOUNT=&SortColumn=SYL_Y&MobileKey=4a69e1fc7d583fe671ad69c95ae6c2b7%7C%7C945235770232353&BUY=true&appType=ttjj&LevelOne=&version=6.3.2&onFundCache=3&Sort=desc&pageIndex=1&FundType=6&CompanyId=&plat=Android&TOPICAL=&ENDNAV=&LevelTwo=&ISABNORMAL=true&DataConstraintType=0&gToken=ceaf-236567466abfda4e2864831ea5645231&ESTABDATE=6&deviceid=4a69e1fc7d583fe671ad69c95ae6c2b7%7C%7C945235770232353'
    print(urldecode(params))